﻿using GeoJSON.Net.Feature;
using SPW.Infrastructure.Enums;
using SPW.Infrastructure.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SPW.Infrastructure.Interfaces
{
    /// <summary>
    /// Skyline 数字地球集成
    /// </summary>
    public interface ISGWorld
    {
        /// <summary>
        /// 是否渲染完成
        /// </summary>
        bool IsReaderCompleted { get; }
        /// <summary>
        /// 渲染地球
        /// </summary>
        /// <returns></returns>
        IReaderOperating Reader();
        /// <summary>
        /// 绘制
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        IDrawingOperating Drawing(DrawingMode mode, Action<DrawResult, IDrawingOperating> callback);
        /// <summary>
        /// 关闭绘制
        /// </summary>
        void CloseDrawing();
        /// <summary>
        /// 拾取
        /// </summary>
        /// <param name="callback"></param>
        /// <returns></returns>
        void Pick(Action<TerraExplorerX.IGeometry> callback);
        /// <summary>
        /// 飞行漫游
        /// </summary>
        void FlyRoam(double x, double y, double distance, double pitch);
    }

    /// <summary>
    /// 渲染操作
    /// </summary>
    public interface IReaderOperating
    {
        /// <summary>
        /// 打开fly项目
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        bool OpenProject(string path);
        /// <summary>
        /// 打开模型
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        bool OpenModel(string path);
        /// <summary>
        /// 打开图层
        /// </summary>
        /// <param name="displayName">图层名称</param>
        /// <param name="tableName">表名称</param>
        /// <param name="connString">连接字符串</param>
        IFeatureOperating OpenLayer(string displayName, string tableName, string connString);
    }

    /// <summary>
    /// 要素操作
    /// </summary>
    public interface IFeatureOperating
    {
        /// <summary>
        /// 创建
        /// </summary>
        bool Create();
        /// <summary>
        /// 修改
        /// </summary>
        void Modify();
        /// <summary>
        /// 删除
        /// </summary>
        bool Delete();
    }

    /// <summary>
    /// 通用资源回收接口
    /// </summary>
    public interface IGeneralDisposable : IDisposable
    {
        bool IsDispose { get; }
    }

    /// <summary>
    /// 交互操作
    /// </summary>
    public interface ISGWorldInteractionOperating : IGeneralDisposable
    {
        /// <summary>
        /// 鼠标移动
        /// </summary>
        void Frame();
        /// <summary>
        /// 鼠标左键点击
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        bool LeftButtonDown(int flags, int x, int y);
        /// <summary>
        /// 鼠标右键点击
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        bool RightButtonDown(int flags, int x, int y);
    }

    /// <summary>
    /// 绘制操作
    /// </summary>
    public interface IDrawingOperating : IGeneralDisposable
    {
        /// <summary>
        /// 移除要素
        /// </summary>
        void Remove();
    }
}
